package cn.webrx;/*
 * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
 *
 */

/**
 * <p>Project: javase - cn.webrx.Switch3
 * <p>Powered by webrx On 2021-11-25 09:24:58
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Switch4 {
    public static void main(String[] args) {
        int y = 2021;
        int m = 11;
        int day = 31;
        switch (m) {
            case 4:
            case 6:
            case 9:
            case 11:
                day = 30;
                break;
            case 2:
                //var d = LocalDate.of(y, m, 1);
                //day = d.isLeapYear() ? 29 : 28;
                day = y % 400 == 0 || (y % 4 == 0 && y % 100 != 0) ? 29 : 28;
                break;
        }
        System.out.printf("%d年%d月有%d天。%n", y, m, day);
    }
}
